package org.study.flyway.boot.startup;

import org.flywaydb.core.Flyway;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 作用描述
 *
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2023年06月05日
 */
@Component
public class MyCommandLineRunner implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        // 注意：不要在代码中暴露敏感配置，这里仅仅为了测试
        Flyway.configure()
                .dataSource("jdbc:mysql://localhost:3306/test_table_version?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai", "root", "root")
                .load()
                .migrate();
    }
}
